#include<stdio.h>
#include<stdlib.h>
#include<string.h>
using namespace std;
typedef struct date{
    int year;
    int month;
    int day;
}datea;
typedef struct staff{
    char id[10];
    char name[10];
    struct date d;
    struct staff *next;
}*sta; 
sta createStaffList(){
    sta head=NULL;
    sta p1,p2;
    char tid[10];
    scanf("%s",tid);
    while(strcmp(tid,"0000")!=0){
        p1=(sta)malloc(sizeof(struct staff));
        strcpy(tid,p1->id);
        scanf("%s %d %d %d",p1->name,&p1->d.year,&p1->d.month,&p1->d.day);
        if(head==NULL){
            head=p1;
            p1->next=NULL;
        }else if(strcmp(p1->id,head->id)<0){
            p1->next=head;
            head=p1;
        }else{
            p2=head;
            while(strcmp(p1->id,p2->next->id)>0)
                p2=p2->next;
            p1->next=p2->next;
            p2->next=p1;
        }
        scanf("%s",tid);
    }
    return head;
}
void printStaff(sta head){
    sta p=head;
    while(p){
        printf("%s\t%s\t%d/%d/%d",p->id,p->name,p->d.year,p->d.month,p->d.day);
        p=p->next;
    }
}
int main(){
    sta head=NULL;
    head=createStaffList();
    printStaff(head);
    return 0;
}  